//package com.chester.springbootseventeen.config;
//
//
//import org.springframework.amqp.core.AmqpAdmin;
//import org.springframework.amqp.core.AmqpTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.io.Serializable;
//import java.util.Map;
//
///**
// * @author chester7cheng
// */
//@Component
//public class Producer {
//
//    @Autowired
//    private AmqpTemplate amqpTemplate;
//    @Autowired
//    private AmqpAdmin amqpAdmin;
//
//    public void sendDirectMsg(String routingKey, Serializable msg){
//        amqpTemplate.convertAndSend(routingKey, msg);
//    }
//
//    public void sendExchangeMsg(String exchange, String routingKey, Serializable msg){
//        amqpTemplate.convertAndSend(exchange, routingKey, msg);
//    }
//
//    public void sendHeadersMsg(String exchange, Map<String, Object> map, Serializable msg){
//        amqpTemplate.convertAndSend(exchange, null, msg, messagePostProcessor -> {
//            messagePostProcessor.getMessageProperties().getHeaders().putAll(map);
//            return messagePostProcessor;
//        });
//    }
//}
